# -*- coding:utf-8 -*-
import sys
import os
from python import utils
import configparser as conf

if __name__ == "__main__" :
	resultDic={}
	global_properties=utils.get_global_properties()
	flow_type=global_properties["flow_type"]
	partition=utils.get_partition_by_flow_type(flow_type,global_properties)
	resultDic['partition']=partition
	try:
		cf = conf.ConfigParser()
		db_conf=global_properties["db_conf"]
		db_section_name=global_properties["mssql_section"]
		cf.read(db_conf,encoding='utf-8' )
		db_password=cf.get(db_section_name,'password')
		db_username=cf.get(db_section_name,'user')
		db_host=cf.get(db_section_name,'host')
		db_port=cf.get(db_section_name,'port')
		db_name=cf.get(db_section_name,'db')
		resultDic['db_password']=db_password
		resultDic['db_username']=db_username
		resultDic['db_host']=db_host
		resultDic['db_port']=db_port
		resultDic['db_name']=db_name
		resultDic['db_conn']="jdbc:sqlserver://%s:%s;DatabaseName=%s" % (db_host,db_port,db_name)
	except:
		print "-------read db conf exception"
	else:
		print "-------read db conf success"
	print "========================="
	print resultDic
	print "========================="
	utils.put_value_to_global_properties(resultDic)